<extend name="Layout:form" />
<block name="title"><title>管理员管理</title></block>
<block name="subnav">
    <a class="add fb" href="__MODULE__/User/add"><em>添加管理员</em></a>&nbsp;&nbsp;&nbsp;
    <a class="" href="__MODULE__/User/index"><em>管理员列表</em></a>
</block>
<block name="main">
    <form name="myform" id="myform" action="__MODULE__/User/add" method="post">
        <table cellpadding=0 cellspacing=0 class="table_form" width="100%">
            <tr>
                <td width="10%" >帐号</td>
                <td width="90%">
                    <input type="text" class="input-text" name="info[account]" id="account" value="" size="40"/>
                </td>
            </tr>
            <tr>
                <td width="10%">密码</td>
                <td width="90%">
                    <input type="password" class="input-text " name="info[pwd]" id="password" value="" size="40"/>
                </td>
            </tr>
            <tr>
                <td width="10%">重复密码</td>
                <td width="90%">
                    <input type="password" class="input-text " name="info[re_pwd]" id="pwdconfirm" value="" size="40"/>
                </td>
            </tr>
            <tr>
                <td width="10%" >状态</td>
                <td width="90%">
                    <label style="float:left;width:75px">
                        <input type="radio" class="input_radio " name="info[status]" id="status_1" checked value="1"> 启用
                    </label>
                    <label style="float:left;width:75px">
                        <input type="radio" class="input_radio " name="info[status]" id="status_2"  value="0" > 禁用
                    </label>
                </td>
            </tr>
            <tr>
                <td width="10%">角色</td>
                <td width="90%">
                    <select id="role_id" name="info[role_id]">
                        <option value="0">请选择角色</option>
                        <?php foreach ($roles as $key => $role) { ?>
                        <option value="<?php echo $role['id']; ?>"><?php echo $role['name']; ?></option>
                        <?php } ?>
                    </select>
                </td>
            </tr>
        </table>
        <div class="bk15"></div>
        <div class="btn">
            <input type="submit" name="dosubmit" id="dosubmit" value="提交" class='button'>&nbsp;<input type="reset" value="重置" class='button'>
        </div>
    </form>
</block>
<block name="footer">
    <script type="text/javascript">
        $(function(){
            $.formValidator.initConfig({autotip:true,formid:"myform",onerror:function(msg){}});
            $("#password").formValidator({onshow:"密码应该为6-20位之间",onfocus:"密码应该为6-20位之间"}).inputValidator({min:6,max:20,onerror:"密码应该为6-20位之间"});
            $("#pwdconfirm").formValidator({onshow:"请再次输入密码。",onfocus:"请再次输入密码。",oncorrect:"密码输入一致"}).compareValidator({desid:"password",operateor:"=",onerror:"两次密码不一致。"});
            $("#account").formValidator({onshow:"请输入管理员名称",onfocus:"请输入管理员名称",oncorrect:"输入正确"}).inputValidator({min:1,onerror:"请输入管理员名称"});
            $("#role_id").formValidator({onshow:"请选择角色",onfocus:"请选择角色",oncorrect:"输入正确"}).inputValidator({min:1,onerror:"请选择角色"});
            // .ajaxValidator({type:"get",url:"__CONTROLLER__/public_check_poster",data:"",datatype:"html",cached:false,async:'true',success : function(data) {if( data == "1" ) { return true; } else { return false; } }, error: function(){alert("服务器没有返回数据，可能服务器忙，请重试");}, onerror : "该广告已存在", onwait : "正进行合法性校验..."});
        });
    </script>
</block>